package com.yiwenup.struct._01_linear.queue;

import com.yiwenup.struct._04_heap.BinaryHeap;

/**
 * 优先级队列（使用堆实现）
 **/
public class PriorityQueue<E> {

    private BinaryHeap<E> heap = new BinaryHeap<>();

    public int size() {
        return heap.size();
    }

    public boolean isEmpty() {
        return heap.isEmpty();
    }

    public void enQueue(E ele) {
        heap.add(ele);
    }

    public E deQueue() {
        return heap.remove();
    }

    public E head() {
        return heap.get();
    }

    public void clear() {
        heap.clear();
    }
}
